Skip to content

Require pymysql[rsa]>=1.2.4 so use_tls=False connections log in to MySQL 8 - #1756

Open
dimitri-yatsenko wants to merge 2 commits into
masterfrom
fix/pymysql-rsa
Open

dimitri-yatsenko wants to merge 2 commits into
masterfrom
fix/pymysql-rsa

Conversation

@dimitri-yatsenko

Copy link
Copy Markdown
Member

Summary

  • Depend on pymysql[rsa]>=1.2.4 instead of pymysql>=1.1.1. The rsa extra installs cryptography.
  • Update pixi.lock: pymysql 1.2.4 and cryptography in every environment.
  • Add an integration test that connects with use_tls=False as a new caching_sha2_password account, so the server has no cached login and the full password exchange runs without TLS.
  • Update the example conda recipe in RELEASE_MEMO.md.

Why

Since 2.3.6, use_tls=False disables TLS on MySQL; in 2.3.5 the connection still used TLS. Without TLS, PyMySQL needs the cryptography package to log in with MySQL 8's default authentication (caching_sha2_password, also sha256_password) whenever the server has no cached login for the account: a new account, or after a server restart, FLUSH PRIVILEGES, or a password change. datajoint did not depend on cryptography, so such logins failed with RuntimeError: 'cryptography' package is required ....

PyMySQL 1.2.1, 1.2.2 and 1.2.3 fail the same login even with cryptography installed (AttributeError: 'NoneType' object has no attribute 'is_auth_switch_request'). 1.2.0 and 1.2.4 work. The new minimum of 1.2.4 skips those releases and keeps the CVE-2024-36039 fix that the old minimum was for.

The new test fails without cryptography and with PyMySQL 1.2.3, and passes with this change. PostgreSQL connections are not affected.

Release note

Since 2.3.6, use_tls=False disables TLS on MySQL connections. Without TLS, logging in to MySQL 8 with caching_sha2_password or sha256_password needs the cryptography package and PyMySQL 1.2.4 or later. DataJoint 2.3.7 installs both (pymysql[rsa]>=1.2.4).

Packaging

The conda-forge recipe must make the same change: pymysql >=1.2.4 and cryptography (PyMySQL's rsa extra asks for cryptography>=46.0.7; conda has no extras, so list it directly).

Fixes #1750

Since 2.3.6, use_tls=False disables TLS on MySQL. Without TLS, a MySQL 8
login with caching_sha2_password or sha256_password needs the
cryptography package whenever the server has no cached login for the
account. PyMySQL's rsa extra installs it. PyMySQL 1.2.1 to 1.2.3 fail that
login even with cryptography, so the minimum moves to 1.2.4.

Adds an integration test that logs in without TLS as a new
caching_sha2_password account. Updates pixi.lock and the conda recipe
example in RELEASE_MEMO.md.

Fixes #1750

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MySQL: with use_tls=False, 2.3.6 needs the cryptography package to log in to MySQL 8

1 participant